package com.hsd.controller;


import com.hsd.service.ICategoryService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;

@Controller
@RequestMapping("/api/index/category")
public class CategoryController extends BaseController{

    @Resource
    private ICategoryService iCategoryService;

    /**
     * 显示所有的分类
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/all",method = RequestMethod.GET)
    public Map<String,Object> findAllCategory(){
        return response(iCategoryService.findAll());
    }


    /**
     * 通过标记显示该标记下的所有分类信息
     * @param tag
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/tag",method = RequestMethod.GET)
    public Map<String,Object> findAllGoods(String tag){
        return response(iCategoryService.findByTag(tag));
    }
}
